

package com.gamutsoft.amb.common.bean;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * <h3>Class name</h3>
 * <h4>Description</h4>
 * <h4>Special Notes</h4>
 * 
 * @ver 0.1
 * @author Terry.wei 2011.5.5
 */
public class CondictionsBean {

	private String property;

	private Object value;

	private String condiction = "=";

	private String relation = "";

	private String startStr = "";

	private String endStr = "";

	private Object anotherValue;

	/**
	 * @return the property
	 */
	public String getProperty() {
		return property;
	}

	/**
	 * @param property
	 *            the property to set
	 */
	public void setProperty(String property) {
		this.property = property;
	}

	/**
	 * @return the value
	 */
	public Object getValue() {
		return value;
	}

	/**
	 * @param value
	 *            the value to set
	 */
	public void setValue(Object value) {
		this.value = value;
	}

	/**
	 * @return the condiction
	 */
	public String getCondiction() {
		return condiction;
	}

	/**
	 * @param condiction
	 *            the condiction to set
	 */
	public void setCondiction(String condiction) {
		this.condiction = condiction;
	}

	/**
	 * @return the relation
	 */
	public String getRelation() {
		return relation;
	}

	/**
	 * @param relation
	 *            the relation to set
	 */
	public void setRelation(String relation) {
		this.relation = relation;
	}

	public static CondictionsBean condictionsBeanConfig(String property, Object value, String relation, String condiction) {
		CondictionsBean bean = new CondictionsBean();
		bean.setProperty(property);
		bean.setValue(value);
		if (StringUtils.isNotBlank(relation)) {
			bean.setRelation(relation);
		}
		if (StringUtils.isNotBlank(condiction)) {
			bean.setCondiction(condiction);
		}

		return bean;
	}

	/**
	 * @return the startStr
	 */
	public String getStartStr() {
		return startStr;
	}

	/**
	 * @param startStr
	 *            the startStr to set
	 */
	public void setStartStr(String startStr) {
		this.startStr = startStr;
	}

	/**
	 * @return the endStr
	 */
	public String getEndStr() {
		return endStr;
	}

	/**
	 * @param endStr
	 *            the endStr to set
	 */
	public void setEndStr(String endStr) {
		this.endStr = endStr;
	}

	public Object getAnotherValue() {
		return anotherValue;
	}

	public void setAnotherValue(Object anotherValue) {
		this.anotherValue = anotherValue;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
